import request from "@/utils/request";
// 用户登录接口
export const login = (data) => request.post("/sys/login", data);
//获取用户信息接口
export const getUserInfo = () => request.get("/sys/profile");
//用户修改密码接口
export const updatePassword = (data) =>
  request.put("/sys/user/updatePass", data);
//获取员工列表
export const getUserList = (page, pagesize, departmentId,keyword) =>
  request.get(
    `/sys/user?page=${page}&pagesize=${pagesize}&departmentId=${departmentId}&keyword=${keyword}`
  );
//导出员工的接口
export const exportUser = ()=>request({
  url:'/sys/user/export',
  //改变数据的接收类型
  responseType:'blob'
})
//下载员工模板接口
export const downloadUser = ()=>request({
  url:'/sys/user/import/template',
  responseType:'blob'
})
//上传接口
export const uploadUser = (data) => request.post('/sys/user/import', data);
//删除用户的接口
export const deleteUser = (id)=>request.delete(`/sys/user/${id}`)
//添加或者修改员工的回调
export const addOrUpdateUser = (data)=>{
  if(data.id) {
    return request.put(`/sys/user/${data.id}`,data)
  }else {
    return request.post(`/sys/user`,data)
  }
}
//获取员工详细数据
export const getUserDetail = (id)=>request.get(`/sys/user/${id}`)

